﻿import gs.TweenLite;
import mx.utils.Delegate;
/**
 * ...
 * @author wangjun
 */
class cn.eminia.A2.ui.FramePannel extends cn.eminia.A2.ui.Pannel
{
	
	public function FramePannel() 
	{
		super();
		this._visible = true;
		this._alpha = 100;
		stop();
	}
	public function toNext( vars:Object) {
		var onEnd:Function = (vars.onEnd != null)?vars.onEnd:null;
		
		TweenLite.to(this, .4, { _alpha:0, 
			onComplete:Delegate.create(this,function() { 
				this.nextFrame();
				TweenLite.to(this, .4, { _alpha:100,  
					onComplete:Delegate.create(this,function() {
							onEnd(); 
							trace(this._currentframe);
					})
					}
				)
			})
		});
	}
	public function toPre( vars:Object) {
		var onEnd:Function = (vars.onEnd != null)?vars.onEnd:null;
		
		TweenLite.to(this, .4, { _alpha:0, 
			onCompleteScope:this,
			onComplete:function() {
				this.prevFrame();
				TweenLite.to(this, .4, {_alpha:100, 
					onComplete:function() {
						onEnd();
					}						
				})
			}
		});
	} 
	public function open( vars:Object) { 
		var onComplete:Function = (vars.onComplete != null)?vars.onComplete:null;
		super.open(false,onComplete);
	}
	public function close( vars:Object) { 
		var onComplete:Function = (vars.onComplete != null)?vars.onComplete:null;
		super.close(false,onComplete);
	}
}